from django.shortcuts import render
from rest_framework.response import Response
from rest_framework.views import APIView

from home import models, ser


# Create your views here.
class TopNav(APIView):
    def get(self, request):
        top = models.Nav.objects.filter(isdel=False,position=1).order_by('sort')
        topser = ser.NavSerializer(top, many=True)
        return Response({'msg':'ok','data':topser.data,'code':200})
class FootNav(APIView):
    def get(self, request):
        foot = models.Nav.objects.filter(isdel=False,position=0).order_by('sort')
        footser = ser.NavSerializer(foot, many=True)
        return Response({'msg':'ok','data':footser.data,'code':200})